package lmycc.test.demo.repository;

import lmycc.test.demo.domain.Student;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface LoginRepository extends JpaRepository<Student, Integer> {

    @Modifying
    @Query(value = "update student set password=?2 where name=?1 ", nativeQuery = true)
    void resetPwd(String name, String password);

    Student findByNameAndPassword(String name, String password);

    List<Student> findByName(String name);
}
